package remote;

import java.rmi.RemoteException;
import java.sql.*;

public class SimpleConnection extends ConnectionAdapter {
	   private RemoteConnection rconn;
	   
	   public SimpleConnection(RemoteConnection c) {
	      rconn = c;
	   }
	   
	   public Statement createStatement() throws SQLException {
	      try {
	         RemoteStatement rstmt = rconn.createStatement();
	         return new SimpleStatement(rstmt);
	      }
	      catch(RemoteException e) {
	         throw new SQLException(e);
	      }
	   }
	   
	   public void close() throws SQLException {
	      try {
	         rconn.close();
	      }
	      catch(RemoteException e) {
	         throw new SQLException(e);
	      }
	   }
	   
	   public void commit() throws SQLException {
		   try {
			   rconn.commit();
		   }
		   catch(RemoteException e) {
			   throw new SQLException(e);
		   }
	   }
	   
	   public void setAutoCommit(boolean autoCommit) throws SQLException {
		   try {
			   rconn.setAutoCommit(autoCommit);
		   }
		   catch(RemoteException e) {
			   throw new SQLException(e);
		   }
	   }
	}
